import { requestClient } from '#/api/request';
import type { PageResult } from '#/api/common';
import type { TableColumnVO, TableColumnForm, TableColumnQuery } from '#/api/demo/gathe/tableColumn/types';

/**
 * 查询采集字段列表
 * @param query
 * @returns {*}
 */

export const listTableColumn = (query?: TableColumnQuery) =>
  requestClient.get<PageResult<TableColumnVO>>('/gathe/tableColumn/list', { params: query });

/**
 * 查询采集字段详细
 * @param id
 */
export const getTableColumn = (id: string | number) =>
  requestClient.get<TableColumnVO>(`/gathe/tableColumn/${id}`);

/**
 * 新增采集字段
 * @param data
 */
export const addTableColumn = (data: TableColumnForm) =>
  requestClient.postWithMsg<void>('/gathe/tableColumn', data);

/**
 * 修改采集字段
 * @param data
 */
export const updateTableColumn = (data: TableColumnForm) =>
  requestClient.putWithMsg<void>('/gathe/tableColumn', data);

/**
 * 删除采集字段
 * @param id
 */
export const delTableColumn = (id: string | number | Array<string | number>) =>
  requestClient.deleteWithMsg<void>(`/gathe/tableColumn/${id}`);
